package com.huonan.component.web.service;

import com.huonan.component.redis.RedisClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@AllArgsConstructor
@Service
@Slf4j
public class RedisService {
    RedisClient redisClient;

    public boolean testLock() {
        boolean testLock = redisClient.lock("atest_lock", 10L);
        if (testLock) {
            log.info("获取锁成功");
        } else {
            log.info("获取锁失败");
        }
        return testLock;
    }

    /**
     * 序列化
     */
    public void testStrSerialize(String value) {
        redisClient.setStr("test_ser_key", value);
    }
}
